/*
 * @(#)HiddenTag.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework.taglib.html;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

/**
  HiddenTag.java

  <p>This class is to to addin javascript checing during input hidden onchange. </p>
  <p>Purpose to Override struts taglib for tracing form modification.<p>
  <p>Modification in "struts-html.tld"<br>
  <pre>
     [FROM]
     &lt;tagclass&gt;org.apache.struts.taglib.html.HiddenTag&lt;/tagclass&gt;
     [TO]
     &lt;tagclass&gt;com.dcivision.framework.taglib.html.HiddenTag&lt;/tagclass&gt;

     [ADDED]
     No addition attribute is added
  </pre>
  </p>

    @author          Rollo Chan
    @company         DCIVision Limited
    @creation date   09/07/2003
    @version         $Revision: 1.9 $
*/

public class HiddenTag extends org.apache.struts.taglib.html.HiddenTag {

  public static final String REVISION = "$Revision: 1.9 $";


  public int doStartTag() throws JspException {
    FormTag formTag = (FormTag)BodyTagSupport.findAncestorWithClass(this, FormTag.class);

    // Add the javascript control to trace whether the form fields have been
    // modified or not if necessary.
    if (formTag!=null && formTag.getTraceChange()) {
      String originalOnchange = this.getOnchange();
      originalOnchange = (originalOnchange == null) ? "" : originalOnchange;
      this.setOnchange(BaseHandler.ONCHANGE_JS_FUNCTION + originalOnchange);
    }
    return(super.doStartTag());
  }
  
  public void release() {
    super.release();
  }
}
